const { Service } = require('egg');

class GithubService extends Service{
    async getFollowers (user_name, page, per_page){
        let qry_params = {
            'page': page,
            'per_page': per_page
        }
        let fetch_api = `https://api.github.com/users/${user_name}/followers`
        let res = await this.ctx.curl(fetch_api, {'method': 'GET', data: qry_params, dataType: 'json'});
        return res;
    }
}

module.exports = GithubService;